You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to hear all possible feedback on this implementation before I add anything. I understand where @aaronmcdaid is coming from; it feels very awkward to convert to/from pseudo-random-number-generators, but I suppose it works and provides a pure interface.
Love the rewrite, @iitalics . I've only just now managed to read it fully, learning more Racket on the way (parameters and parameterize).
There is an issue with random/io where it will usually give the same value repeatedly. This is because it recreates each time and Racket seeds it with a function of the current time (down to milliseconds). Usually, two consecutive draws are at the same time and therefore the same seed. When I run this code, I tend to get runs of four or five identical integers:
(Edited) Now I think I realise what you are doing with the RandomT code at the end that you have commented out. It's about chaining the computations together, and this would be relevant to starting with one called to make-io-prng and then feeding that into a stream of computations.)
I agree that it probably makes sense to provide an interface to create a fresh PRNG. It may also make sense to provide a random/io function, but make it use Racket’s global/default PRNG. There’s no need to have a pure, self-contained generator if you can only use it in IO, anyway, since it’s random, and other modifications to the generator state are not meaningfully observable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'd like to hear all possible feedback on this implementation before I add anything. I understand where @aaronmcdaid is coming from; it feels very awkward to convert to/from
pseudo-random-number-generators, but I suppose it works and provides a pure interface.